package com.jbl.gof23.create.factory;

import com.jbl.gof23.create.factory.factorymrthod.BaoMaFactory;
import com.jbl.gof23.create.factory.factorymrthod.WuLingFactory;
import com.jbl.gof23.create.factory.simplefactory.SimpleFactory;

/**
 * 消费者
 */
public class Consumer {
    public static void main(String[] args) {
        //不使用工厂模式创建车
        CarImpl car = new CarImpl();
        CarImpl2 carImpl2 = new CarImpl2();
        car.name();
        carImpl2.name();

        //使用简单工厂创建
        Car c = SimpleFactory.getCar("五菱");
        c.name();
        System.out.println("===========");

        //使用工厂方法创建
        Car car1 = new BaoMaFactory().getCar();
        Car car2 = new WuLingFactory().getCar();
        car1.name();
        car2.name();
    }

}
